package com.atguigu.day08.work;

public enum Month {
    JANUARY(1,"1月份"),
    FEBRUARY(2,"2月份"),
    MARCH(3,"3月份"),
    APRIL(4,"4月份"),
    MAY(5,"5月份"),
    JUNE(6,"6月份"),
    JULY(7,"7月份"),
    AUGUST(8,"8月份"),
    SEPTEMBER(9,"9月份"),
    OCTOBER(10,"10月份"),
    NOVEMBER(11,"11月份"),
    DECEMBER(12,"12月份");

    private int value;
    private String description;

    Month(int value, String description) {
        this.value = value;
        this.description = description;
    }
    public static Month getByValue(int value){
        if (value<1||value>12){
            return null;
        }
        return Month.values()[value-1];
    }

    @Override
    public String toString() {
        return value+"->"+name()+"->"+description;
    }
}
